Micron Document
welo git mirrors

Node / public / reticulum / commits / f880edb

Commit f880edbeb8ebb3089bffae79a02eeba8cf75f4e1


Parents : 2b97c89
Author : Mark Qvist <mark@unsigned.io>
Date : 2021-05-20T12:44:12+02:00

Store GROUP destination symmetric key as bytes instead of base64

Changes

1 files changed, 3 insertions(+), 7 deletions(-)


Diff

diff --git a/RNS/Destination.py b/RNS/Destination.py
index c0c80a185..57a345df5 100755
--- a/RNS/Destination.py
+++ b/RNS/Destination.py
@@ -5,9 +5,6 @@ import RNS
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.backends import default_backend
-from cryptography.hazmat.primitives import serialization
-from cryptography.hazmat.primitives.asymmetric import rsa
-from cryptography.hazmat.primitives.asymmetric import padding
class Callbacks:
def __init__(self):
@@ -32,7 +29,6 @@ class Destination:
"""
KEYSIZE = RNS.Identity.KEYSIZE;
- PADDINGSIZE= RNS.Identity.PADDINGSIZE;
# Constants
SINGLE = 0x00
@@ -245,8 +241,8 @@ class Destination:
raise TypeError("A single destination holds keys through an Identity instance")
if self.type == Destination.GROUP:
- self.prv_bytes = Fernet.generate_key()
- self.prv = Fernet(self.prv_bytes)
+ self.prv_bytes = base64.urlsafe_b64decode(Fernet.generate_key())
+ self.prv = Fernet(base64.urlsafe_b64encode(self.prv_bytes))
def get_private_key(self):
@@ -278,7 +274,7 @@ class Destination:
if self.type == Destination.GROUP:
self.prv_bytes = key
- self.prv = Fernet(self.prv_bytes)
+ self.prv = Fernet(base64.urlsafe_b64encode(self.prv_bytes))
def load_public_key(self, key):
if self.type != Destination.SINGLE:

Served by rngit 1.5.1 - Generated in 0.02s